import time

from selenium import webdriver
from selenium.webdriver.common.by import By

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC


driver = webdriver.Chrome()

driver.get("https://www.baidu.com/")

#页面最大化
driver.maximize_window()

#Xpath定位
driver.find_element(By.XPATH,'//*[@id="kw"]').send_keys("cxk")
driver.find_element(By.XPATH,'//*[@id="su"]').click()

el1 = WebDriverWait(driver, 5).until(EC.presence_of_element_located((By.XPATH, '//*[@id="s_tab_inner"]/a[2]/span')))
el1.click()

driver.implicitly_wait(3)
driver.find_element(By.XPATH,'//*[@id="s_tab_inner"]/a[2]/span')

time.sleep(3)
#关闭驱动对象
driver.quit()